/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package co.gov.igac.observatorio.entidades.propuesta;

import java.io.Serializable;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

/**
 *
 * @author bigbang
 */
@Entity
@Table(name = "tipoimpacto")
@NamedQueries({
    @NamedQuery(name = "Tipoimpacto.findAll", query = "SELECT t FROM Tipoimpacto t"),
    @NamedQuery(name = "Tipoimpacto.findByIdTipoImpacto", query = "SELECT t FROM Tipoimpacto t WHERE t.idTipoImpacto = :idTipoImpacto"),
    @NamedQuery(name = "Tipoimpacto.findByNombre", query = "SELECT t FROM Tipoimpacto t WHERE t.nombre = :nombre")})
public class Tipoimpacto implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @NotNull
    @Column(name = "idTipoImpacto")
    private Integer idTipoImpacto;
    @Size(max = 1000)
    @Column(name = "nombre")
    private String nombre;
    @OneToMany(mappedBy = "tipoimpacto")
    private List<Impacto> impactoList;

    public Tipoimpacto() {
    }

    public Tipoimpacto(Integer idTipoImpacto) {
        this.idTipoImpacto = idTipoImpacto;
    }

    public Integer getIdTipoImpacto() {
        return idTipoImpacto;
    }

    public void setIdTipoImpacto(Integer idTipoImpacto) {
        this.idTipoImpacto = idTipoImpacto;
    }

    public String getNombre() {
        return nombre;
    }

    public void setNombre(String nombre) {
        this.nombre = nombre;
    }

    public List<Impacto> getImpactoList() {
        return impactoList;
    }

    public void setImpactoList(List<Impacto> impactoList) {
        this.impactoList = impactoList;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idTipoImpacto != null ? idTipoImpacto.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Tipoimpacto)) {
            return false;
        }
        Tipoimpacto other = (Tipoimpacto) object;
        if ((this.idTipoImpacto == null && other.idTipoImpacto != null) || (this.idTipoImpacto != null && !this.idTipoImpacto.equals(other.idTipoImpacto))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.nombre;
    }
    
}
